
$(function(){
    $('button.btn').click(function(){
        var act_tittle = $('input[name="act_tittle"]').val();
        var act_decribe = $('textarea[name="act_decribe"]').val();
        var act_img = $('input[name="act_img"]').val();
        var act_price = $('input[name="act_price"]').val();
        var act_start_time = $('input[name="act_start_time"]').val();
        var act_stop_time = $('input[name="act_stop_time"]').val();
        var start_time = $('input[name="start_time"]').val();
        var end_time = $('input[name="end_time"]').val();
        var act_type_code = $('select[name="act_type_code"]').val();
        var act_organizer = $('input[name="act_organizer"]').val();
        var act_joiner_num = $('input[name="act_joiner_num"]').val();
        var act_address = $('input[name="act_address"]').val();

        if (act_tittle == '') {
            $('input[name="act_tittle"]').focus();
            $('input[name="act_tittle"]').addClass('bcolor');
            return;
        } else {
            $('input[name="act_tittle"]').removeClass('bcolor');
        }

        if (act_decribe == '') {
            $('textarea[name="act_decribe"]').focus();
            $('textarea[name="act_decribe"]').addClass('bcolor');
            return;
        } else {
            $('textarea[name="act_decribe"]').removeClass('bcolor');
        }

        if (act_img == '') {
            $('input[name="act_img"]').focus();
            $('input[name="act_img"]').addClass('bcolor');
            return;
        } else {
            $('input[name="act_img"]').removeClass('bcolor');
        }

        if (act_price == '' || isNaN(act_price)) {
            $('input[name="act_price"]').focus();
            $('input[name="act_price"]').addClass('bcolor');
            return;
        } else {
            $('input[name="act_price"]').removeClass('bcolor');
        }

        if (act_start_time == '') {
            $('input[name="act_start_time"]').addClass('bcolor');
            return;
        } else {
            $('input[name="act_start_time"]').removeClass('bcolor');
        }

        if (act_stop_time == '') {
            $('input[name="act_stop_time"]').addClass('bcolor');
            return;
        } else {
            $('input[name="act_stop_time"]').removeClass('bcolor');
        }

        if (start_time == '') {
            $('input[name="start_time"]').addClass('bcolor');
            return;
        } else {
            $('input[name="start_time"]').removeClass('bcolor');
        }

        if (end_time == '') {
            $('input[name="end_time"]').addClass('bcolor');
            return;
        } else {
            $('input[name="end_time"]').removeClass('bcolor');
        }
        //活动类别验证
        if (act_type_code == '') {
            $('select[name="act_type_code"]').focus();
            $('select[name="act_type_code"]').addClass('bcolor');
            return;
        } else {
            $('select[name="act_type_code"]').removeClass('bcolor');
        }

        if (act_organizer == '') {
            $('input[name="act_organizer"]').focus();
            $('input[name="act_organizer"]').addClass('bcolor');
            return;
        } else {
            $('input[name="act_organizer"]').removeClass('bcolor');
        }

        if (act_joiner_num == '') {
            $('input[name="act_joiner_num"]').focus();
            $('input[name="act_joiner_num"]').addClass('bcolor');
            return;
        } else {
            $('input[name="act_joiner_num"]').removeClass('bcolor');
        }

        if (act_address == '') {
            $('input[name="act_address"]').focus();
            $('input[name="act_address"]').addClass('bcolor');
            return;
        } else {
            $('input[name="act_address"]').removeClass('bcolor');
        }
        $('form').submit();
    })
});
